package pl.vm.domain;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * Owner of the Virtual Teams, and its personal data.
 * @author krzysztof.graczyk
 *
 */
public class Owner {

	private String nickname;
	private String firstName;
	private String lastName;
	private String address;
	private String phoneNumber;
	private String email;
	private Set<VirtualTeam> teams = new HashSet<>();
	
	public Owner(String nickname, String firstName, String lastName, String address, String phoneNumber, String email) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.phoneNumber = phoneNumber;
		this.email = email;
		this.nickname = nickname;
	}

	public void createNewTeam(String name) {
		teams.add(new VirtualTeam(name, this, 0));
	}
	
	public void removeTeam(String name) {
		Iterator<VirtualTeam> teamsIterator = teams.iterator();
		VirtualTeam team;
		while(teamsIterator.hasNext()) {
			team  = teamsIterator.next();
			if (team.getName().equals(name)) {
				teamsIterator.remove();
				break;
			}
		}
	}
	
	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public String getEmail() {
		return email;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

}
